home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / lib_show / number / example1.e next >
Text File  |  2000-03-25  |  2KB  |  55 lines

  1. -- This file is  free  software, which  comes  along  with  SmallEiffel. This
  2. -- software  is  distributed  in the hope that it will be useful, but WITHOUT
  3. -- ANY  WARRANTY;  without  even  the  implied warranty of MERCHANTABILITY or
  4. -- FITNESS  FOR A PARTICULAR PURPOSE. You can modify it as you want, provided
  5. -- this header is kept unaltered, and a notification of the changes is added.
  6. -- You  are  allowed  to  redistribute  it and sell it, alone or as a part of
  7. -- another product.
  8. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  9. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  10. --                       http://SmallEiffel.loria.fr
  11. --
  12. class EXAMPLE1
  13.    --
  14.    -- To start with NUMBERs, just compile an run it :
  15.    -- 
  16.    --            compile -o example1 -boost example1
  17.    --
  18.  
  19. inherit NUMBER_TOOLS;
  20.  
  21. creation make
  22.  
  23. feature
  24.  
  25.    make is
  26.       local
  27.          max, n1, n2: NUMBER;
  28.       do
  29.          max := from_integer(Maximum_integer);
  30.          io.put_string("The maximum integer value on this architecture is:%N%
  31.                        %      max = ");
  32.          io.put_number(max);
  33.          io.put_string("%Nmax + max = ");
  34.          io.put_number(max + max);
  35.          io.put_string("%Nmax * max = ");
  36.          io.put_number(max * max);
  37.          io.put_string("%NDo you like NUMBERs ?%N");
  38.  
  39.          io.put_string("So have a look at NUMBERs division:%N");
  40.          n1 := from_integer(2);
  41.          n2 := from_integer(6);
  42.          io.put_string("Assume n1 = ");
  43.          io.put_number(n1);
  44.          io.put_string("  and n2 = ");
  45.          io.put_number(n2);
  46.          io.put_string("  then  n1/n2 = ");
  47.          io.put_number(n1 / n2);
  48.          io.put_string("%NWith NUMBER, you always get the exact result.%N");
  49.          io.put_string("%NDo you like NUMBERs ?%N%
  50.                        %Have a look at example #2 to know more about NUMBERs%N");
  51.       end;
  52.  
  53. end -- EXAMPLE1
  54.  
  55.